import io

import cv2

import ddddocr
ocr = ddddocr.DdddOcr(det=True)
from  PIL import  Image
#orc

# with open("./static/yzm/img.png","rb") as f :
#
#     r = ocr.classification(f.read())
#     print(r)


#目标检测能力
with open("./static/yzm/img_1.png","rb") as f :

    f = f.read()

box = ocr.detection(f)


im = cv2.imread("./static/yzm/img_1.png")

print(im)

print(box)

for bbox in box:
    x1,y1,x2,y2 = bbox
    im = cv2.rectangle(im,(x1,y1),(x2,y2),(0,255,0),2)

cv2.imwrite("./static/yzm/img_1_result.png",im)